package com.example.icongyou.api;



import com.example.icongyou.bean.Assignment;
import retrofit2.Call;
import retrofit2.http.*;

import java.util.List;

public interface AssignmentApi {

    // 创建作业
    @POST("assignments")
    Call<Assignment> createAssignment(@Body Assignment assignment);

    // 根据ID获取作业
    @GET("assignments/{id}")
    Call<Assignment> getAssignment(@Path("id") Long id);

    // 根据课程ID获取作业列表
    @GET("assignments/course/{courseId}")
    Call<List<Assignment>> getAssignmentsByCourse(@Path("courseId") Long courseId);

    // 获取所有作业
    @GET("assignments")
    Call<List<Assignment>> getAllAssignments();

    // 更新作业
    @PUT("assignments/{id}")
    Call<Assignment> updateAssignment(@Path("id") Long id, @Body Assignment assignment);

    // 删除作业
    @DELETE("assignments/{id}")
    Call<Void> deleteAssignment(@Path("id") Long id);

    // 根据课程ID删除作业
    @DELETE("assignments/course/{courseId}")
    Call<Void> deleteAssignmentsByCourse(@Path("courseId") Long courseId);

    // 获取活跃作业（未截止的作业）
    @GET("assignments/active")
    Call<List<Assignment>> getActiveAssignments();

    // 统计课程作业数量
    @GET("assignments/course/{courseId}/count")
    Call<Integer> countAssignmentsByCourse(@Path("courseId") Long courseId);
}
